﻿using System;
using System.Data.Linq;
using DR.DBDomainModel;
using DR.Repository.Abstract;

namespace DR.Repository.Concrete.LinqToSql
{
    public class LinqToSqlReportingPeriodRepository : LinqToSqlBaseRepository<ReportingPeriod, int>, IReportingPeriodRepository
    {
        public LinqToSqlReportingPeriodRepository(string connectionString) : base(connectionString)
        {            
        }

        protected override Table<ReportingPeriod> GetDataTable(DataContext dataContext)
        {
            return dataContext.GetTable<ReportingPeriod>();
        }

        protected override System.Linq.Expressions.Expression<Func<ReportingPeriod, bool>> GetIDQuery(int id)
        {
            return r => r.ReportingPeriogID == id;
        }

        protected override int GetEntityID(ReportingPeriod entity)
        {
            return entity.ReportingPeriogID;
        }
    }
}
